package com.rongmei.jdsync.dto;

import io.swagger.v3.oas.annotations.media.Schema;

import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;


/**
 * 京东商品列表查询请求参数DTO
 *
 * @author dongjun
 */
@Data
@Schema(description = "商品列表查询请求参数")
public class GoodsRequestDto {
    @Schema(description = "当前页码，从1开始")
    @Min(value = 1, message = "页码最小为1")
    private Integer page = 1;

    @Schema(description = "每页记录数")
    @Min(value = 1, message = "每页数量最小为1")
    @Max(value = 50, message = "每页数量最大为50")
    private Integer limit = 50;

    @Schema(description = "搜索关键词，支持商品名称模糊匹配", example = "")
    private String keyword;

    @Schema(description = "分类ID，查询指定分类下的商品")
    private Integer categoryId;

    @Schema(description = "最低价格，单位元")
    @Min(value = 0, message = "价格不能为负数")
    private Double minPrice;

    @Schema(description = "最高价格，单位元")
    @Min(value = 0, message = "价格不能为负数")
    private Double maxPrice;

    @Schema(description = "是否包邮：0-否，1-是")
    private Integer isFreeShipping;

    @Schema(description = "排序字段", example = "complex",
            allowableValues = {"price", "sales", "complex"})
    private String order = "complex";

    @Schema(description = "排序方式", example = "desc",
            allowableValues = {"asc", "desc"})
    private String sort = "desc";

    @Schema(description = "优惠券ID，查询可使用指定优惠券的商品")
    private String coupon;

    @Schema(description = "品牌ID，查询指定品牌的商品")
    private Integer brandId;

    @Schema(description = "站点ID，查询指定站点的商品")
    private Integer siteId;

    @Schema(description = "标签ID，查询带有指定标签的商品")
    private Integer labelId;

    @Schema(description = "商品类型：1-普通商品，2-秒杀商品，3-拼团商品",
            example = "1", allowableValues = {"1", "2", "3"})
    private Integer goodsType = 1;

    @Schema(description = "经度，用于距离排序", example = "120.002344")
    private Double longitude;

    @Schema(description = "纬度，用于距离排序", example = "30.2875")
    private Double latitude;

    @Schema(description = "其他参数，预留字段")
    private Integer other;

}
